Overview
In order to re-use a circuit definition it must be exported as a component. The exporter creates a manifest file that describes the essential details of the component, thereby allowing it to be imported into another circuit definition as a new instance. Once a circuit definition has been exported, it appears in the Custom Definitions tool window and can be dragged on as described in Adding Primitives and Circuit Instances to a Definition.
Export Scope
There are two scopes at which components can be exported:
- Local Scope
- Global Scope
When a definition is exported locally, it appears in the Custom Definitions tool window when Local is selected and it can be seen and re-used within the same project. Other projects cannot see the component using this type of export.
When a definition is exported globally, it appears in the Custom Definitions tool window when Global is selected and it can be seen and re-used by any project. A global export creates a component archive (.bpa) file that contains everything that is required to instantiate that component on another machine. This consists of:
- The component manifest file
- The component prototype
- The binary source
As a result, it is necessary to specify the compiled Blueprint Library (.lib) file that is to be released with the exported component. When the component is imported into another project, possibly on a different machine, this release library is extracted and placed into a folder called BpLibs under the project's root directory. All of the libraries contained in BpLibs should be linked into the main application in order to provide the component implementations. While developing components it may be desirable to link with a debug library and in this case, it is recommended that the debug libraries for components be output to a known location and referenced by the application rather than providing debug libraries to the exporter.
How to Export a Definition
Local Export
Local export occurs every time the definition is saved and the definition is exported using the description and category information provided by the definition attributes. This means that if you update the interface to your component and save it then each instance of that component will determine that they are out of date and turn red to notify you that they require updating. Updating an instance is achieved by right clicking on it and selecting Update Instance.
Global Export
Global export is an explicit operation. To export a definition globally, select File | Export Definition from the main menu. This causes the following dialog to be displayed:
The dialog is populated with the default information provided by the definition attributes and this information can be modified, if necessary. Select Export to perform the export. Instead of creating the component manifest in the local project, a complete archive is produced as described above and it is added to the global custom definitions repository located beneath your Visual Studio documents folder.
Importing a Definition
Definitions are imported using the Custom Definitions tool window. For more information see Adding Primitives and Circuit Instances to a Definition.
Sharing Component Definitions
The Global Export functionality allows you to share components easily within your organization and even across commercial boundaries. Each component is archived into a .bpa file that contains the prototype and implementation for the component and a .bpc file that contains a description of the component for the Custom Definitions window. By simply placing these two files in your end user's custom definitions folder allows them to use the component.
Another important feature of the global export is that only the circuit prototype is visible to the end user. The circuit definition and all of the source code is pre-compiled into the binary library and therefore your IP is protected. The following example shows an imported global definition, when opened by the instantiating project:
The most convenient way to share components within an organization is to connect your global custom definitions folder to a shared repository using a source control technology such as Subversion. This means that when you add a new component you can quickly add it to the source control repository, making it available to everybody else and getting the latest component implementations is then as simple as running an update. Components that have changed their interfaces will appear in your circuits with a red outline and you will need to update them but where the implementation has changed but not the interface, the new implementation will be used without any additional intervention.